<!DOCTYPE html>
<html>
<head>
  <style>
    .square {
      position: absolute;
      background: blue;
      width: 20px;
      height: 20px;
      left: 0px;
      -webkit-transition-timing-function: linear;
      -webkit-transition-duration: 2s;
    }

    #square1 {
      top: 20px;
      -webkit-transition-property: left;
      -webkit-transition-delay: -1s;
    }
    #square2 {
      top: 60px;
      -webkit-transition-property: left;
    }
    .moved {
      left: 600px;
    }

    #square3 {
      top: 100px;
      -webkit-transition-property: transform;
      -webkit-transition-delay: -1s;
    }
    #square4 {
      top: 140px;
      -webkit-transition-property: transform;
    }
    .translated {
      transform: translateX(600px);
    }
  </style>

  <script src="../animations/resources/animation-test-helpers.js"></script>

  <script>
    // The delays of squares 1 and 3 are negative, so they should be ahead.
    const expectedValues = [
      // [time, element-id, property, expected-value, tolerance]
      [0.0, "square1", "left", 300, 15],
      [0.0, "square2", "left",   0, 15],
      [0.5, "square1", "left", 450, 15],
      [0.5, "square2", "left", 150, 15],
      [0.0, "square3", "-webkit-transform.4", 300, 20],
      [0.0, "square4", "-webkit-transform.4",   0, 20],
      [0.5, "square3", "-webkit-transform.4", 450, 20],
      [0.5, "square4", "-webkit-transform.4", 150, 20],
    ];

    function setupTest()
    {
      document.getElementById('square1').className = 'moved square';
      document.getElementById('square2').className = 'moved square';
      document.getElementById('square3').className = 'translated square';
      document.getElementById('square4').className = 'translated square';
    }
  
    runTransitionTest(expectedValues, setupTest);
  </script>
</head>

<body>

<div class="square" id="square1"></div>
<div class="square" id="square2"></div>
<div class="square" id="square3"></div>
<div class="square" id="square4"></div>

<div id="result">
</div>

</body>
</html>
